package org.vogelsk.archangelsk;

import java.io.IOException;

import android.app.Activity;
import android.content.res.AssetManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;


public class Main extends Activity {

	private Tanks tanks;

    @Override
    public void onCreate(Bundle savedInstanceState) {
		Bitmap tankL = null;
		Bitmap tankU = null;
		Bitmap tankD = null;
		Bitmap tankR = null;
		Bitmap wallOK = null;
		Bitmap wallD = null;
		Bitmap reddot = null;
	    Bitmap tankDestroyedImage = null;
    	AssetManager manager = getAssets();
    	super.onCreate(savedInstanceState);
      try {
		tankL = BitmapFactory.decodeStream(manager.open("tankl.gif"));
		tankU = BitmapFactory.decodeStream(manager.open("tanku.gif"));
		tankD = BitmapFactory.decodeStream(manager.open("tankd.gif"));
		tankR = BitmapFactory.decodeStream(manager.open("tankr.gif"));
		wallOK = BitmapFactory.decodeStream(manager.open("brick.jpg"));
		wallD = BitmapFactory.decodeStream(manager.open("brickdestroyed.gif"));
		reddot = BitmapFactory.decodeStream(manager.open("red_dot.png"));
		tankDestroyedImage = BitmapFactory.decodeStream(manager.open("boom.gif"));
	} catch (IOException e) {
		e.printStackTrace();
	}

      tanks = new Tanks(this, reddot, wallOK, wallD, tankL, tankR, tankU, tankD,
  			tankDestroyedImage) ;   

      setContentView(tanks);

    }
    
    @Override
    protected void onPause() {
    	tanks.setInGame(false);
    	super.onPause();
    }
}